<template>
  <el-button type="primary" @click="">角色</el-button>

  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="name" label="名称" width="180" />
    <el-table-column prop="alias" label="别名" width="180" />
    <el-table-column prop="password" label="密码" />
  </el-table>
</template>

<script setup>
import {ref, onMounted} from 'vue'
import api_role from '@/api/system/role'


const tableData = ref(null)
const searchQuery = ref('')

// 获取表格数据
const fetchTableData = async () => {
  try {
    const params = { q: searchQuery.value }
    const response = await api_role.getRoles(params)
    tableData.value = response.data || []
    console.log(response.data)
    console.log('aaaaaa')
  } catch (error) {
    console.error('获取数据失败:', error)
  }
}

// 初始化获取数据
onMounted(() => {
  fetchTableData()
})
</script>
